package com.tqjc.business.interactivewithscan.entity;

import com.alibaba.fastjson.JSONObject;
import com.tqjc.business.interactivewithscan.consts.ActionEnum;
import lombok.Data;

/**
 * @program: C20005_Xianggang_new
 * @description: 设备命令信息
 * @author: Patienyon
 * @create: 2023-11-01 19:23
 **/
@Data
public class DeviceCommandData<T> {
    /**
     * 执行次命令的设备线程，设备信息
     */
    private ScanDeviceData device;

    /**
     * 用于下发命令的设备socket
     */
    private DeviceSocketClient socketClient;

    /**
     * 动作命令
     */
    private ActionEnum actionEnum;

    /**
     * 动作命令
     */
    private Class<T> rc;

    /**
     * 命令参数
     */
    private JSONObject dynamicValues;

    public DeviceCommandData() {
    }

    public DeviceCommandData(ScanDeviceData device, DeviceSocketClient socketClient, ActionEnum actionEnum, Class<T> rc, JSONObject dynamicValues) {
        this.device = device;
        this.socketClient = socketClient;
        this.actionEnum = actionEnum;
        this.rc = rc;
        this.dynamicValues = dynamicValues;
    }

    public DeviceCommandData(ScanDeviceData device, DeviceSocketClient socketClient, ActionEnum actionEnum, Class<T> rc) {
        this.device = device;
        this.socketClient = socketClient;
        this.actionEnum = actionEnum;
        this.rc = rc;
    }

    /**
     * 是否答应命令日志
     */
    private boolean log = true;

    public JSONObject getDynamicValues() {
        if (dynamicValues == null) {
            dynamicValues = new JSONObject();
        }
        return dynamicValues;
    }

    private Integer retry = 0;
}
